package com.wanghua.mall.user.config;

import com.wanghua.mall.user.interceptor.UserInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author wanghua
 * @create 2021-09-07 8:49
 */
@Configuration
public class UserWebConfig implements WebMvcConfigurer {

    @Resource
    private UserInterceptor userInterceptor;

    /**
     * 添加拦截器
     *
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(userInterceptor).addPathPatterns("/**");
    }
}
